<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    
    function  F(something){
        console.log(this.a,something)
        return this.a + something;
    }     
    function bind(fn,obj){
        return function(){
            return fn.apply(obj,arguments)//给F函数绑定obj对象 arguments:参数
        }
    }
    var obj = {
        a:2
    }
    var bar = bind(F,obj)
    var b = bar(3);//arguments 3
    console.log("b" + b)
// 使用new来调用foo()时 我们会构造一个新对象并把它绑定到foo(..)调用中的this上
 function foo(a){
     this.a = a;
 }
 var bar = new foo(2)
 console.log(bar.a)

</script>
</html>                                                                                                                                                                                                                                                                                                                                                        